package oop5.pc;

public class Pc {   //计算机
    public static void main(String[] args) {
        Pc pc = new Pc("惠普");
        pc.setCpu(new Intel(3.8));
        pc.setYingPan(new Rom(3000));
        pc.setNeiCun(new Ram(4));
        pc.setMouse(new UsbMouse("USB鼠标"));
        pc.setKeyboard(new Keyset("机械硬盘"));
        pc.print();
    }

    private String brand;    //Pc品牌

    /*
    不能认为Pc有，应该是打印Cpu、YingPan(硬盘)、NeiCun(内存)的属性，应该是Pc提供了Cpu、YingPan、NeiCun的三个接口
     */
    private Cpu cpu;
    private YingPan yingPan;
    private NeiCun neiCun;
    private Mouse mouse;
    private Keyboard keyboard;

    public Pc(String brand) {
        this.brand = brand;
    }

    public void print() {   //成员方法(实例方法)
        System.out.println(brand + "计算机的信息如下：");
        cpu.show();
        yingPan.show();
        neiCun.show();
        mouse.show();
        keyboard.show();
    }

    public String getBrand() {  //业务方法
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public void setCpu(Cpu cpu) {
        this.cpu = cpu;
    }

    public void setYingPan(YingPan yingPan) {
        this.yingPan = yingPan;
    }

    public void setNeiCun(NeiCun neiCun) {
        this.neiCun = neiCun;
    }

    public void setMouse(Mouse mouse) {
        this.mouse = mouse;
    }

    public void setKeyboard(Keyboard keyboard) {
        this.keyboard = keyboard;
    }
}
